package com.poker.task;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class VerifyTask {
    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");


//    private UserVerifyService verifyService;

    @Scheduled(cron = "0 0/5 * ? * ?")
    public void reportCurrentTime() {
        System.out.println("现在时间：" + dateFormat.format(new Date()));

//        List<UserVerify> verifies = verifyService.findByObserver(true);
//        for (UserVerify verify: verifies) {
//            LocalDateTime nowTime = LocalDateTime.now();
//
//            Date observerEndTime = verify.getObserverEndTime();
//            Instant instant = observerEndTime.toInstant();
//            ZoneId zoneId = ZoneId.systemDefault();
//            LocalDateTime endTime = LocalDateTime.ofInstant(instant, zoneId);
//
//            if (nowTime.isAfter(endTime)) verifyService.updateVerifyObserver(false, verify);
//        }

    }
}
